package day05;
import java.util.Arrays;
public class Practice01 {
    public static void main(String[] args) {
        //1.MaxOfArray求数组元素最大值并放在最后一个元素的下一个位置
        //要求：声明整型数组并填充随机数据，找到最大值，将数组扩容并将最大值放末尾
        int[]arr01 = new int[6];
        for(int j=0;j< arr01.length;j++){
            arr01[j]=(int)(Math.random()*100);
        }
        int max = arr01[0];
        for (int h =1;h< arr01.length;h++) {
            if (arr01[h] > max) {
                max = arr01[h];
            }
        }
            arr01=Arrays.copyOf(arr01,arr01.length+1);
            arr01[arr01.length-1] = max;
            System.out.println(arr01[arr01.length-1]);



        //2.方法的练习
        //调用方法
        say1();
        sayHi("lbw");
        say2(2027,"mnb");
        double goldenRatio = rate();
        int fianlScore = sum(80,99);
        int[] arr1 =array(6,100);
        System.out.println(arr1[0]);

    }
//各种类型方法
    public static void say1(){
        System.out.println("2023年，pxl祝你新年快乐");
    }
    public static void sayHi(String name){
        System.out.println("2023年，"+name+"祝你新年快乐");
    }
    public static void say2(int year,String name){
        System.out.println(year+"年"+name+"祝你新年快乐");
    }
    public static double rate(){
        return 0.618;
    }
    public static int sum(int num_1,int num_2){
        int sum = num_1+num_2;
        return sum;
    }
    public static int[]array(int leng,int magnify){
        int arr[]=new int[leng];
        for (int i =0;i<arr.length;i++){
            arr[i]= (int)(Math.random()*(magnify+1));
        }
        return arr;
    }
}
